SuperSelect=new Object();
SuperSelect.fAdd=function (sSelectId, sFormName, sSelectName){
	var sLabel=new String();
	var oSelect=window.document.getElementById(sSelectId);
	
	sLabel=prompt(this.sPromptNewLabel,'');
	if(sLabel==null || sLabel.length<1) return;
	oSelect.options[oSelect.options.length] = new Option(sLabel,this.sNoId);
	oSelect.selectedIndex=oSelect.options.length-1;	
	
	this.fCreateDomNodes(sSelectId, sFormName, sSelectName);
}
SuperSelect.fRemove=function (sSelectId, sFormName, sSelectName){
	var oSelect=window.document.getElementById(sSelectId);
	
	if(!confirm(this.sConfirmRemove) || oSelect.value.length<1) return;
	oSelect.options[oSelect.selectedIndex]=null;
	
	this.fCreateDomNodes(sSelectId, sFormName, sSelectName);
}
SuperSelect.fEdit=function (sSelectId, sFormName, sSelectName){
	var oSelect=window.document.getElementById(sSelectId);		
	var nSelectedIndex=oSelect.selectedIndex;
	
	if(oSelect.options[nSelectedIndex].text.length>0){
		sLabel=prompt(this.sPromptNewLabel,oSelect.options[nSelectedIndex].text);		
		if(sLabel==null || sLabel.length<1) return;
		oSelect.options[nSelectedIndex]=new Option(sLabel,oSelect.options[nSelectedIndex].value);
		oSelect.selectedIndex=nSelectedIndex;
	} else {
		this.fAdd(sSelectId, sFormName, sSelectName);
	}
	
	this.fCreateDomNodes(sSelectId, sFormName, sSelectName);
}

SuperSelect.fCreateDomNodes=function (sSelectId, sFormName, sSelectName){
	var oSelect=document.getElementById(sSelectId);
	var oForm=document.forms[sFormName];
	var div = new String();
	this.fRemoveAllDomNodes(sFormName, sSelectName);
	if (oSelect.options.length>0){
		for (i in oSelect.options){
			if(typeof(oSelect.options[i])=='object' && oSelect.options[i]!=null && !isNaN(i)){
				if(typeof(oSelect.options[i])!='undefined' && oSelect.options[i].text.length>0){
					div += '<input type="hidden" name="'+sSelectName+'['+i+'][text]'+'" value="'+oSelect.options[i].text+'">';
					div += '<input type="hidden" name="'+sSelectName+'['+i+'][value]'+'" value="'+oSelect.options[i].value+'">';
				}
			}
		}
	}
	document.getElementById(sSelectName+"_div").innerHTML = div;
	this.fSetSelectedDomNodes(sFormName, sSelectId, sSelectName);
}	

SuperSelect.fRemoveAllDomNodes=function(sFormName, sSelectName){

}

SuperSelect.fSetSelectedDomNodes=function(sFormName,sSelectId,sSelectName){
	var oSelect=window.document.getElementById(sSelectId);
	document.forms[sFormName][sSelectName+'[selected][value]'].value=oSelect.value;
	document.forms[sFormName][sSelectName+'[selected][text]'].value=oSelect.options[oSelect.selectedIndex].text;
}